package conductores;

import java.util.ArrayList;
import java.util.List;

import aima.search.framework.SuccessorFunction;

public class SucesorConductoresSA implements SuccessorFunction {

	@Override
	public List<Object> getSuccessors(Object state) {
		Board board = (Board) state;
	    ArrayList<Object> successors = new ArrayList<Object>();
	    //System.out.println("LLegan en hora"+board.llegadaEnHora()+" de tantos conductores "+ board.conductores.size());
	    
	    //IOperator operacion = Context.getInstance().getOperaciones().get(Context.random.nextInt(Context.getInstance().getOperaciones().size()));
	    
	    for(int condO=0; condO<board.getConductores().size(); condO++) {
	    //int condO = Context.random.nextInt(board.getConductores().size());
	    	Conductor conductorOrigen =  board.getConductores().get(condO);
	    	IOperator operacion = Context.getInstance().getOperaciones().get(Context.random.nextInt(Context.getInstance().getOperaciones().size()));
	    	operacion.execute(board, condO, conductorOrigen, successors);
	    }
	    
	    return successors;
	}

}
